<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>函数调用栈：闭包</title>
</head>
<body>
  <script>
function f1() {
  var n = 999;
  function f2() {
    console.trace()
    alert(n);
  }
  return f2;
}
var result = f1();
result(); // 999
  </script>
</body>
</html>